home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import java.awt.Component;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.InputEvent;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseMotionListener;
- import java.io.Serializable;
- import java.util.EventObject;
-
- class BasicSplitPaneDivider$MouseHandler extends MouseAdapter implements MouseMotionListener, Serializable {
- // $FF: synthetic field
- BasicSplitPaneDivider this$0;
-
- public void mousePressed(MouseEvent e) {
- if (((EventObject)e).getSource() == this.this$0.splitPane && this.this$0.dragger == null && this.this$0.splitPane.isEnabled()) {
- Component newHiddenDivider = this.this$0.splitPaneUI.getNonContinuousLayoutDivider();
- if (this.this$0.hiddenDivider != newHiddenDivider) {
- if (this.this$0.hiddenDivider != null) {
- this.this$0.hiddenDivider.removeMouseListener(this);
- this.this$0.hiddenDivider.removeMouseMotionListener(this);
- }
-
- this.this$0.hiddenDivider = newHiddenDivider;
- if (this.this$0.hiddenDivider != null) {
- this.this$0.hiddenDivider.addMouseMotionListener(this);
- this.this$0.hiddenDivider.addMouseListener(this);
- }
- }
-
- if (this.this$0.splitPane.getLeftComponent() != null && this.this$0.splitPane.getRightComponent() != null) {
- if (this.this$0.orientation == 1) {
- this.this$0.dragger = new BasicSplitPaneDivider.DragController(this.this$0, e);
- } else {
- this.this$0.dragger = new BasicSplitPaneDivider.VerticalDragController(this.this$0, e);
- }
-
- if (!this.this$0.dragger.isValid()) {
- this.this$0.dragger = null;
- } else {
- this.this$0.prepareForDragging();
- this.this$0.dragger.continueDrag(e);
- }
- }
-
- ((InputEvent)e).consume();
- }
-
- }
-
- public void mouseReleased(MouseEvent e) {
- if (this.this$0.dragger != null) {
- if (((EventObject)e).getSource() == this.this$0.splitPane) {
- this.this$0.dragger.completeDrag(e.getX(), e.getY());
- } else if (((EventObject)e).getSource() == this.this$0.hiddenDivider) {
- this.this$0.getLocation();
- Point hDividerLoc = this.this$0.hiddenDivider.getLocation();
- int ourX = e.getX() + hDividerLoc.x;
- int ourY = e.getY() + hDividerLoc.y;
- this.this$0.dragger.completeDrag(ourX, ourY);
- }
-
- this.this$0.dragger = null;
- }
-
- this.this$0.splitPane.setCursor(BasicSplitPaneDivider.defaultCursor);
- ((InputEvent)e).consume();
- }
-
- public void mouseDragged(MouseEvent e) {
- if (this.this$0.dragger != null) {
- if (((EventObject)e).getSource() == this.this$0.splitPane) {
- this.this$0.dragger.continueDrag(e.getX(), e.getY());
- } else if (((EventObject)e).getSource() == this.this$0.hiddenDivider) {
- this.this$0.getLocation();
- Point hDividerLoc = this.this$0.hiddenDivider.getLocation();
- int ourX = e.getX() + hDividerLoc.x;
- int ourY = e.getY() + hDividerLoc.y;
- this.this$0.dragger.continueDrag(ourX, ourY);
- }
-
- ((InputEvent)e).consume();
- }
-
- }
-
- public void mouseMoved(MouseEvent e) {
- if (this.this$0.dragger == null) {
- int eventX = e.getX();
- int eventY = e.getY();
- Rectangle bounds = this.this$0.getBounds();
- if (eventX >= bounds.x && eventX < bounds.x + bounds.width && eventY >= bounds.y && eventY < bounds.y + bounds.height) {
- if (this.this$0.orientation == 1) {
- if (this.this$0.splitPane.getCursor() != BasicSplitPaneDivider.horizontalCursor) {
- this.this$0.splitPane.setCursor(BasicSplitPaneDivider.horizontalCursor);
- }
- } else if (this.this$0.splitPane.getCursor() != BasicSplitPaneDivider.verticalCursor) {
- this.this$0.splitPane.setCursor(BasicSplitPaneDivider.verticalCursor);
- }
- } else if (this.this$0.splitPane.getCursor() != BasicSplitPaneDivider.defaultCursor) {
- this.this$0.splitPane.setCursor(BasicSplitPaneDivider.defaultCursor);
- }
-
- }
- }
-
- // $FF: synthetic method
- BasicSplitPaneDivider$MouseHandler(BasicSplitPaneDivider this$0) {
- this.this$0 = this$0;
- }
- }
-